/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package myftp.app.view.listener;

import java.awt.event.ActionEvent;
import myftp.app.model.TransfertTableModel;
import myftp.core.view.listener.TemplateActionListener;

/**
 *
 * @author CAVARLE Glenn, LUCAS Stéphane
 * Listener de l'annulation d'un transfert
 */
public class StopActionListener extends TemplateActionListener {

    /**
     * Table des transferts
     * @var transfertsTable
     */
    TransfertTableModel transfertsTable;
    /**
     * Indice du transfert a annuler
     * @var transfertNumber
     */
    public int transfertNumber;

    /**
     * Constructeur StopActionListener
     * @param aTransfertNumber
     * @param aTransfertsTable
     */
    public StopActionListener(int aTransfertNumber, TransfertTableModel aTransfertsTable) {
        super();
        this.transfertsTable = aTransfertsTable;
        this.transfertNumber = aTransfertNumber;
    }

    @Override
    public void actionPerformed(ActionEvent e) {

        /* Mise en paramètres */
        this.controller.setActionParam("table", transfertsTable);
        this.controller.setActionParam("number", transfertNumber);

        /* Lancement du thread d'annulation du transfert */
        this.controller.dispatch("StopAction");
    }
}
